<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>权限编辑--博客后台管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
	<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
	<script type="text/javascript" src="../../js/template-web.js"></script>
	<script type="text/javascript" src="../../layui/layui.js"></script>
	<script type="text/javascript" src="authorUpdate.js"></script>
</head>
<body class="childrenBody"></body>
<script id="updateForm" type="text/html">
	<form class="layui-form">
		<input type="hidden" name="id" value="{{id}}" >
		<div class="layui-form-item">
			<label class="layui-form-label">权限名称</label>
			<div class="layui-input-block">
				<input type="text"  name="name"  value="{{title}}" class="layui-input" lay-verify="required" lay-verify="required" placeholder="请输入您的昵称">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">所属父权限</label>
			<div class="layui-input-inline">
				<div class="layui-unselect layui-form-select downpanel">
					<div class="layui-select-title">
						<span class="layui-input layui-unselect" id="treeclass">{{if parent }} {{parent.title}} {{else if !parent}}--请选择-- {{/if}}  </span>
						{{if !parent }}
						<input type="hidden" id="parent.id" value="0" name="parent.id" >
						{{/if}}
						{{if parent }}
						<input type="hidden" id="parent.id"  value="{{parent.id}}" name="parent.id" >
						{{/if}}
						<i class="layui-edge"></i>
					</div>
					<dl class="layui-anim layui-anim-upbit">
						<dd>
							<ul id="authorTree"></ul>
						</dd>
					</dl>
				</div>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">权限类别</label>
			<div class="layui-input-block">
				<select name="type" lay-verify="required">
					<option value="0" {{if type=="0"}}selected {{/if}}>所有人开放</option>
					<option value="1" {{if type=="1"}}selected {{/if}}>菜单权限</option>
					<option value="2" {{if type=="2"}}selected {{/if}}>按钮权限</option>
				</select>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">权限地址</label>
			<div class="layui-input-block">
				<input type="text"  name="url" class="layui-input" value="{{url}}" placeholder="请输入权限名称">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" lay-filter="update">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
</script>

<script>
	$(function(){

		//获取页面的id
		var id = location.href.substr(location.href.lastIndexOf("#")+1);
		//查询数据并回显
		$.get("/author/selectOne.do",{"id":id},function(data){
			var tempHtml = template("updateForm",data);
			$(".childrenBody").html(tempHtml);
			layui.config({
				base : "js/"
			}).use(['form'],function(){
				var form = layui.form();
				form.render();
			})
		})
	})
</script>

</html>